package com.sanjishu.enterlab.electricity.sale.controller;

import com.sanjishu.enterlab.electricity.sale.service.ContractDataService;
import com.sanjishu.enterlab.electricity.sale.service.FileService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Controller
@RequestMapping("contractData")
public class ContractDataController {

    private static final Logger log = LoggerFactory.getLogger(CommonController.class);
    @Autowired
    private FileService fileService;
    @Autowired
    private ContractDataService contractDataService;

    @RequestMapping(value="uploadFileData",method= RequestMethod.POST)
    @ResponseBody
    public Response uploadFileData(MultipartFile file, Integer types, Integer contractId){
        log.info("上传图片");
        String filePath = fileService.uploadImg1(file);
        return contractDataService.updateContractData(types, contractId, filePath);
    }

}
